package com.e1xp.deport_management_system.exception;

/**
 * @author E1xP@foxmail.com
 * @version 1.0
 * @PACKAGE_NAME com.e1xp.deport_management_system.exception
 * @CLASS_NAME CustomExceptionType
 * @Description TODO 自定义异常类型
 * @Date 2021/2/23 下午 9:23
 **/
public enum CustomExceptionType {
    USER_HAD_BEEN_REGISTER(400, "用户已存在"),
    USER_INPUT_ERROR(400, "用户输入异常"),
    USER_LOGIN_ERROR(400, "用户登陆错误"),
    USER_NOT_FOUND_ERROR(404, "找不到该用户"),
    ORDER_NOT_FOUND_ERROR(404, "找不到该订单"),
    INSTANCE_NOT_FOUND_ERROR(404, "找不到该实例"),
    PRODUCT_NOT_FOUND_ERROR(404, "找不到该商品"),
    RACK_NOT_FOUND_ERROR(404, "找不到该货架"),
    VENDORS_NOT_FOUND_ERROR(404, "找不到该供货商"),
    ORDER_PRODUCT_NOT_FOUND(404, "找不到该订单详情项"),
    OPERATION_NOT_ALLOW(403, "无此操作权限"),
    PICK_MORE_THAN_REQUIRE(400, "拣货数量超过订单需求"),
    PRODUCT_NOT_ENOUGH(400, "商品数量不足"),
    VENDORS_HAD_BEEN_ADD(400, "供货商已存在"),
    RACK_NOT_EMPTY_ERROR(400, "货架不为空"),
    PRODUCT_HAD_BEEN_ADD(400, "商品已存在"),
    RACK_HAD_BEEN_ADD(400, "货架已存在"),
    ;

    private final String typeDesc;//异常类型中文描述
    private final int code; //code

    CustomExceptionType(int code, String typeDesc) {
        this.code = code;
        this.typeDesc = typeDesc;
    }

    public String getTypeDesc() {
        return typeDesc;
    }

    public int getCode() {
        return code;
    }
}
